const path = require('path');
const server = require('./server');
const porject = require('./project');
function resolveDev(dir) {
  return path.join(__dirname, '../', porject.name, 'src/', dir);
}

function resolveBuild(dir) {
  return path.join(__dirname, '../', porject.name, 'dist/', dir);
}
let pConf = {};
try {
  pConf = require(resolveDev('../config'));
} catch (e) {
  //
}
let staticName = pConf.staticName || 'static';
module.exports = {
  name: porject.name,
  staticName,
  dev: {
    static: resolveDev('./' + staticName + '/public/**/*'),
    html: [resolveDev('/**/*.html'), '!' + porject.name + '/src/include/**/*'],
    allhtml: resolveDev('./**/*.html'),
    styles: resolveDev('./' + staticName + '/styles/*.{scss,css}'),
    script: resolveDev('./' + staticName + '/js/**/*.js'),
    images: resolveDev('./' + staticName + '/images/**/*.{png,jpg,gif,svg}'),
    sprite: resolveDev('./' + staticName + '/sprite/**/*.{png,jpg,gif,svg}'),
  },

  build: {
    static: resolveBuild(staticName + '/public'),
    html: resolveBuild(''),
    styles: resolveBuild(staticName + '/css'),
    script: resolveBuild(staticName + '/js'),
    images: resolveBuild(staticName + '/images'),
    sprite: resolveBuild(staticName + '/images/sprite.png'),
  },

  zip: {
    name: 'gulpProject.zip',
    path: resolveBuild('**/*'),
    dest: path.join(__dirname, '../', porject.name),
  },
  server,
  useEslint: false,
  useWebpack: true,
  productionZip: false,
};
